// 引入VueRouter
// 这里使用ES6的语法将VueRouter对象的两个方法解构出来。
import {createRouter,createWebHashHistory} from 'vue-router';


// 申明路由规则
const routes = [
    {path: '/login',component:()=>import('../views/Login.vue'),},
    {path:'/',redirect:'/home/index'},
    {
        path: '/home',
        component: ()=> import("../views/Home.vue"),
        children:[
            {path:'/home/index',components:{"index":()=>import('../views/Welcome.vue')}},
            {path:'/home/user',components:{"user":()=>import('../views/sys/User.vue')}},
            {path:'/home/role',components:{"role":()=>import('../views/sys/Role.vue')}},
            {path:'/home/menu',components:{"menu":()=>import('../views/sys/Menu.vue')}},
            {path:'/home/content',components:{"content":()=>import('../views/cms/Content.vue')}},
            {path:'/home/contentCat',components:{"contentCat":()=>import('../views/cms/ContentCat.vue')}},
            {path:'/home/itemCategory',components:{"itemCategory":()=>import('../views/goods/goods-category.vue')}},
            {path:'/home/itemSpe',components:{"itemSpe":()=>import('../views/goods/goods-spe.vue')}},
            {path:'/home/item',components:{"item":()=>import('../views/goods/goods.vue')}},
        ]
    }
]

// 创建路由对象
const router = createRouter({
    // 使用hash路由
    history:createWebHashHistory(),
    // 路由规则
    routes
})

// 导出路由对象
export default router;
